<!DOCTYPE html>
<html lang="en">
<head>
	<{include file="header.html"}>
	<title>组卷管理-<{$user_data['school_name']}>-德安信会计在线教育平台</title>
	<link href="/static/public/webupload/webuploader.css" rel="stylesheet">
</head>
<body>

    <div style="padding: 0 20px">
        <!--star tabMainCont-->
            <fieldset class="layui-elem-field">
                <legend>按条件搜索</legend>
                <div class="layui-field-box">
                    <form class="layui-form layui-form-pane1" method="post" action="<{$current_url}>">
                        <{assign var="pid" value=$conditions['pid']|default:"all"}>
                        <div class="layui-form-item">

                            <div class="layui-input-inline">
                                <select name="category[cate_id]" class="abc" lay-verify="required" id="cate_id" placeholder="请选择" lay-filter="cate_id">
                                    <option value="0">课程分类</option>
                                    <{foreach from=$cate item=item}>

                                        <option value="<{$item.id}>" <{if $data['cate_id']|default:"" eq $item.id}>selected="selected"<{/if}>><{$item.name}></option>
                                    <{/foreach}>
                                </select>
                            </div>
                            <div class="layui-inline">
                                <select name="category[subject_id]" lay-verify="required" id="subject" placeholder="请选择" lay-filter="subject">
                                    <option value="">请选择科目</option>
                                     <{foreach from=$subject item=item}>
                                        <option value="<{$item.id}>" <{if $data['subject_id']|default:"" eq $item.id}>selected="selected"<{/if}>><{$item.name}></option>
                                    <{/foreach}>
                                </select>
                            </div>

                            <div class="layui-inline">
                                <input type="text" name="category[search]" placeholder="搜索内容" value="<{if $data['search']}><{$data['search']}><{/if}>" class="layui-input">
                            </div>

                            <div class="layui-inline">
                                <button type="submit" class="layui-btn">搜索</button>
                            </div>
                        </div>
                    </form>
                </div>
            </fieldset>
            <!--商品列表 star-->
            <form class="layui-form layui-form-pane1" method="post" action="/video/update_sorts" delete_action="/video/delete">
                <table class="layui-table" lay-even lay-skin="row">
                    <thead>
                        <tr>
                            <th></th>
                            <th>文件名称</th>
                            <th>时长</th>
                            <th>上架时间</th>
                        </tr>
                    </thead>   
                    <tbody>
                    <{foreach from=$video item=item}>
                    <tr>
                        <td class="not_lb tal"><!-- <input type="checkbox"> -->
                            <input type="radio" class="vids" name="ids" value="<{$item['id']}>" title="<{$item['title']}>">
                        </td>
                        <td class="not_lb tal">
                            <div class="">
                               <div class="t_img">
                                    <img src="<{$item['image_url']}>" height="90" width="150"/>
                               </div>
                                <div class="t_info">
                                    <a class="fs16" href="javascript:;"><{$item['title']}></a>
                                </div>
                            </div>
                        </td>
                        <td class="not_lb tal"><{$item['duration']}></td>
                        <td class="not_lb tal"><{$item['add_time']|date_format:'%Y-%m-%d  %H:%M:%S'}></td>
                    </tr>
                    <{/foreach}>
                    <{if $video|count eq 0}>
                        <tr>
                            <td class="center" style=" height:120px; text-align:center;line-height:120px;" colspan="8">
                                赞无数据！
                            </td>
                        </tr>
                    <{/if}>
                    <tr>
                        <td class="center" colspan="12">
                            <a href="javascript:;" id="tijiao" class="layui-btn layui-btn-primary layui-btn-small" style="margin-top:4px;">提交</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </form>
            <div class="pages p-tb20" style="width:100%">
                <{$pagination}>
                <{if $page_total > 1}>
                <input type="text" class="inputwh" id="yema" placeholder="页码"> <a id="jump" href="javascript:;" h="/course/select_video/<{$data.cate_id}>/<{$data.subject_id}>/<{$data.search}>/">GO</a>
                <{/if}>
            </div>
            <!--商品列表 end -->
        <!--end tabMainCont-->
    </div>
        

<{include file="footer.html"}>
<!--end内容区域-->
<script>
$(function(){
	$.fn.Dashentab(".cetContent .tit","span",".tabMainCont",".tabItem","curr","click",0);
    $("#jump").click(function(){
        var limit = $("#yema").val();
        if(isNaN(limit)){
            return false;
        }
        if(limit <= 0){
            return false;
        }
        if(limit > "<{$page_total}>"){
            alert("最多<{$page_total}>页");
            return false;
        }
        window.location.href=$(this).attr("h") + parseInt(limit-1);
    })
});
layui.use(['form', 'jquery', 'layer'], function(){
    var form = layui.form(),$ = layui.jquery, layer = layui.layer;
    $("#tijiao").click(function(){
        var radio_val = $("input[name='ids']:checked").val();
        var radio_title = $("input[name='ids']:checked").attr('title');
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index);
        var _this = $(this);
        var input = "<p id='vid_"+radio_val+"''>"+radio_title+"</p><input type='hidden' class='selected' name='vid' value='"+radio_val+"'>";
       
        $(window.parent.document).find(".add_video").eq(0).next().empty()
        $(window.parent.document).find(".add_video").eq(0).next().append(input)
    })

    form.on('select(cate_id)', function(data){
        var ii = layer.load();
        var id = data.value;
        $("#course_id").html('<option value="">请选择科目</option>');
        form.render('select');
        $.ajax({
            type: "POST",
            url: "/course/get_cate_subject",
            data: {id:id},
            dataType: "json",
            success: function (data) {
                var ddl = $("#subject");
                var html ='<option value="">请选择科目</option>';
                $(data).each(function (key) {
                    html += "<option value='"+data[key].id+"'>"+data[key].name+"</option>";
                });
                $("#subject").html(html);
                form.render('select');
                layer.close(ii);
            }
        });
    });
});
</script>